import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param array int整型一维数组 
     * @return int整型一维数组
     */
    public int[] FindNumsAppearOnce (int[] array) {
        // write code here
        // O(n), O(n)
        /*
        ArrayList<Integer> list = new ArrayList<>();
        Map<Integer, Integer> map = new HashMap<>();
        for (int num: array) {
            map.put(num, map.getOrDefault(num, 0) + 1);
        }
        for (Map.Entry<Integer, Integer> entry: map.entrySet()) {
            if (entry.getValue() == 1) {
                list.add(entry.getKey());
            }
        }
        if (list.get(0) > list.get(1)) 
            return new int[]{list.get(1), list.get(0)};
        else 
            return new int[]{list.get(0), list.get(1)};
        */
        int sum = 0;
        int sum1 = 0;
        int sum2 = 0;

        for (int num : array)
            sum ^= num;

        int k = 1;
        while ((sum & k) == 0) {
            k <<= 1;
        } 
        System.out.println(k);

        for (int num : array) {
            if ((num & k) == 0) {
                sum1 ^= num;
            }
            else {
                sum2 ^= num;
            }
        }

        if (sum1 > sum2) {
            return new int[]{sum2, sum1};
        }
        else {
            return new int[]{sum1, sum2};
        }
    }
}